Memory is prevalent in computer systems and electronic devices. Memory is used to store information, contain programs, records and the like. The integrity of the memory is important for operation of the systems and/or devices associated with it.
Corruption of memory occurs when expected or actual memory contents are erroneously modified. Memory can become corrupted through a variety of mechanisms. Once there is memory corruption, data can be lost, program contents can be modified, systems can become non-operable, and the like.
Physical memory is the hardware based memory that is written to and read from during normal operation. Corruption of physical memory can occur from a variety of sources, such as defective memory, RF interference, and the like. A variety of techniques exist for identifying corruption of physical memory. One example is parity checking, where a parity bit is set upon a write operation and the bit is checked during a read. If the parity bit doesn't match the data, data corruption may have occurred. Additionally, debug logic can configure a watchpoint on a memory location to verify proper read/write access to the memory location. Any errors would result in debug logic and create an alert to allow appropriate corrective action to be taken.
Heap memory, also referred to as dynamic memory, is memory that is allocated during run time of a program. After execution of the program, the allocated memory is returned to a memory pool. The heap memory can be corrupted by programming errors, such as buffer overflows. For example, data written beyond the bounds of allocated memory can corrupt adjacent memory. The corruption may be accidental and result in loss of data. However, the corruption can also be intentional or malicious and result in viruses and security concerns. Unlike program memory meant for program data whose locations are known in advance right after linking, heap memory locations are dynamically determined and not known until runtime. The techniques employed for identifying corruption of physical memory cannot be employed for heap memory because the physical memory utilized changes at runtime.
One technique for identifying corruption of heap memory is to employ conventional debugging breakpoint techniques. However, these techniques are difficult and time consuming to employ. Another technique is to rely on periodic evaluation of the heap memory. However, this may fail to identify corruption or only identify a subset of corruption of heap memory. Further, the periodic evaluations are performed on header sections and omit data sections. As a result, corruption of data sections can be missed. Even if periodic evaluation of the header sections and data is done by known means, such as CRC code comparisons, such evaluation requires significant CPU bandwidth. Thus, in order to maintain standards of performance, faster and more expensive hardware is needed. Further, such solutions have a bearing on bill of materials and increase power consumption. Yet another technique is to monitor function calls and identify calls that fall outside of permitted memory locations. However, this technique fails to check for overflows.